
from ..operation import (
    matchNode,
    getRelationshipByTwoNode
)
from neo4j_db.nodeType import (
    HERO_REGION_NODE_TYPE
)
# 获取所有的区域节点
def getAllRegionNodes():
    nodes = matchNode(nodeType = HERO_REGION_NODE_TYPE)
    if len(nodes) == 0:
        return None
    return nodes

# 获取某个区域节点的相关边
def getRegionNodeRelationships(node):
    relationships = getRelationshipByTwoNode(node)
    return relationships

# 根据名称获取某个节点
def getRegionNodeByName(name):
    nodes = matchNode(nodeType = HERO_REGION_NODE_TYPE, name = name)
    if len(nodes) == 0:
        return None
    node = nodes[0]
    return node